package io.github.aaron.commonadmin.base.vo;

import io.github.aaron.commonadmin.base.util.PageUtils;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

/**
 * @Author: AaronF
 * @Date: 2025/08/25/22:54
 * @Description: 分页请求
 */
public class QueryPageRequest {

    /**
     * 页码，从1开始
     */
    private Integer pageNumber = 1;

    /**
     * 页容量
     */
    private Integer pageSize = 10;

    /**
     * 转换为pageable
     * @return
     */
    public Pageable pageable(){
        return PageUtils.of(pageNumber,pageSize, Sort.Direction.DESC,"id");
    }

    public Integer getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(Integer pageNumber) {
        this.pageNumber = pageNumber;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
}
